package partage;

public class Coordonne {
	private int x,y;
	/**
	 * @param x
	 * @param y
	 */
	public Coordonne(int x, int y) {
		super();
		this.x = x;
		this.y = y;
	}
	public Coordonne() {
		this.x=-1;
		this.y=-1;
	}
	final public static Coordonne valueOf(String coord){
		if(coord.indexOf("Coordonne")>=0){
			String chaine=coord.replace("Coordonne : x= ", "");
			chaine=chaine.replace("y=","");
			chaine=chaine.replaceAll(" ","");
			String XY[]=chaine.split(":");
			return new Coordonne(Integer.parseInt(XY[0]),Integer.parseInt(XY[1]));
		}
		return new Coordonne();
	}
	/**
	 * @return the x
	 */
	public int getX() {
		return x;
	}
	/**
	 * @param x the x to set
	 */
	public void setX(int x) {
		this.x = x;
	}

	/**
	 * @return the y
	 */
	public int getY() {
		return y;
	}

	/**
	 * @param y the y to set
	 */
	public void setY(int y) {
		this.y = y;
	}
	/**
	 * 
	 */
	@Override
	public String toString() {
		return "Coordonne : x= " + x + " : y= " + y;
	}
	
	
}
